/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */

package opensocial.apps.friendforsale.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Activity implements Serializable {
  private static final long serialVersionUID = -441108284596359129L;

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private long lid;
  private long time;
  private long until;
  private String container;
  private String actor;
  private String actorName;
  private String target;
  private String targetName;
  private String thirdParty;
  private String command;
  private String arg1;
  private String arg2;
  private String arg3;
  private String arg4;
  private String arg5;

  private ActivityType type;

  public ActivityType getType() {
    return type;
  }

  public void setType(ActivityType type) {
    this.type = type;
  }

  public Activity() {

  }

  public Activity(long time, String container, String actorId, String victimId,
      String thirdPartyId, String commandId, Object... args) {
    super();
    this.time = time;
    this.container = container;
    this.actor = actorId;
    this.target = victimId;
    this.thirdParty = thirdPartyId;
    this.command = commandId;

    setArgs(args);
  }

  public void setArgs(Object... args) {
    arg5 = args.length > 4 ? args[4].toString() : null;
    arg4 = args.length > 3 ? args[3].toString() : null;
    arg3 = args.length > 2 ? args[2].toString() : null;
    arg2 = args.length > 1 ? args[1].toString() : null;
    arg1 = args.length > 0 ? args[0].toString() : null;
  }

  public long getLogId() {
    return lid;
  }

  public long getTime() {
    return time;
  }

  public String getContainer() {
    return container;
  }

  public String getThirdPartyId() {
    return thirdParty;
  }

  public String getArg1() {
    return arg1;
  }

  public String getArg2() {
    return arg2;
  }

  public String getArg3() {
    return arg3;
  }

  public String getArg4() {
    return arg4;
  }

  public String getArg5() {
    return arg5;
  }

  public String getCommand() {
    return command;
  }

  public void setCommand(String command) {
    this.command = command;
  }

  public String getActor() {
    return actor;
  }

  public void setActor(String actor) {
    this.actor = actor;
  }

  public String getTarget() {
    return target;
  }

  public void setTarget(String target) {
    this.target = target;
  }

  public String getThirdParty() {
    return thirdParty;
  }

  public void setThirdParty(String thirdParty) {
    this.thirdParty = thirdParty;
  }

  public void setContainer(String container) {
    this.container = container;
  }

  public void setTime(long time) {
    this.time = time;
  }

  public long getUntil() {
    return until;
  }

  public void setUntil(long until) {
    this.until = until;
  }

  public String getActorName() {
    return actorName;
  }

  public void setActorName(String actorName) {
    this.actorName = actorName;
  }

  public String getTargetName() {
    return targetName;
  }

  public void setTargetName(String targetName) {
    this.targetName = targetName;
  }

}
